package com.itheima.day09;

import java.util.Scanner;

public class dai09FuXi {
    public static void main(String[] args) {
        //键盘录入
        Scanner sc = new Scanner(System.in);
        //用死循环去寻找正确的水仙花数
        while (true) {
            System.out.println("请输入一个三位数整数");
            int num = sc.nextInt();
            //判断键盘录入的是否为三位数整数
            if (num > 999 || num < 100) {
                System.out.println("输入有误!");
            } else {
                int bai = num / 100;
                int shi = num / 10 % 10;
                int ge = num % 10;
                if (ge * ge * ge + shi * shi * shi + bai * bai * bai == num) {
                    System.out.println(num + "是水仙花数");
                    //找到后结束整个循环
                    break;
                } else {
                    System.out.println(num + "不是水仙花数");
                }
            }
        }
    }
}